<?php
/**
 * @filename:					GardenAction.class.php
 * @desc:						墓地园、区、排模块
 *
 * @author: 					张召
 * @copyright:					winzzhao@sina.com
 * @date:						2011-04-18
 */


class GardenAction extends CommonAction
{    
	/**
	* 关键字搜索园
	*/	
        
    function search()
    {
    	$crumb_info = array(
			array('uri' => '__URL__', 'title' => L('garden_manage'), 'sort' => C('CRUMB_LAST')),
		);

		$this->_mergeCrumbInfo($crumb_info);
		$this->_action_link = array(
			array('uri' => '__URL__/add', 'title' => L('add_garden')),
		);
		$this->assign('crumb_info', $this->_crumb_info);
		$this->assign('action_link', $this->_action_link);
		
    	$garden = new GardenModel();
    	$keywords = $_POST[keywords];
    	$list = $garden->where("keywords='$keywords'")->select(); 
    	$this->assign('list',$list);
    	$this->display (index);
    }

    /**
    * 查看园区排的三级分布，例如：某一区所属于某一园
    */
    public function index()
    {
    	$crumb_info = array(
			array('uri' => '__URL__', 'title' => L('garden_manage'), 'sort' => C('CRUMB_LAST')),
		);

		$this->_mergeCrumbInfo($crumb_info);
		$this->_action_link = array(
			array('uri' => '__URL__/add', 'title' => L('add_garden')),
		);
		$this->assign('crumb_info', $this->_crumb_info);
		$this->assign('action_link', $this->_action_link);
		parent::index();
    }
	/**
    * 查看园的详细信息
    */
    public function view()
    {
    	$crumb_info = array(
			array('uri' => '__URL__', 'title' => L('garden_manage'), 'sort' => C('CRUMB_LAST')),
		);

		$this->_mergeCrumbInfo($crumb_info);
		$this->_action_link = array(
			array('uri' => '__URL__/index', 'title' => L('list_garden')),
		);
		$this->assign('crumb_info', $this->_crumb_info);
		$this->assign('action_link', $this->_action_link);
		parent::view();
    }
    /**
    * 添加新的园
    */
    public function add()
    {
    	$crumb_info = array(
			array('uri' => '__URL__', 'title' => L('garden_manage'), 'sort' => C('CRUMB_DEFAULT')),
			array('uri' => '__URL__/add', 'title' => L('add_garden'), 'sort' => C('CRUMB_LAST')),
		);

		$this->_mergeCrumbInfo($crumb_info);
		$this->_action_link = array(
			array('uri' => '__URL__/index', 'title' => L('list_garden')),
			);

		$this->assign('crumb_info', $this->_crumb_info);
		$this->assign('action_link', $this->_action_link);

		parent::add();

	}

    /**
    * 修改或完善所创建园的详细信息
    */
    public function edit()
    {
    	$crumb_info = array(
			array('uri' => '__URL__', 'title' => L('garden_manage'), 'sort' => C('CRUMB_DEFAULT')),
			array('uri' => '__URL__/edit/id/' . $_REQUEST['id'], 'title' => L('edit_garden'), 'sort' => C('CRUMB_LAST')),
		);

		$this->_mergeCrumbInfo($crumb_info);
		$this->_action_link = array(
			array('uri' => '__URL__/index', 'title' => L('list_garden')),
			);

		$this->assign('crumb_info', $this->_crumb_info);
		$this->assign('action_link', $this->_action_link);
		parent::edit();
	}

    /**
    * 删除某个园
    */
    public function delete()
    {
       parent::delete();
    }
}

?>